<?php
ob_start();
session_start();

$id = $_SESSION['id'];
$service =$_GET['service'];

echo$service;



 try{
         include_once('restconnection.php');
         
         if(isset($client)){
             
            
            //retrive base url 
            $url = $_SESSION['basic_url'];
            //add service url
            $service_url="/DeleteToken?";
            //params url
            $params = array('id'=>$id, 'service'=>$service);
            //params connection
            $ctx = stream_context_create(array('http' => array('timeout' => 1))); 
            //send GET request
            //print_r($url.$service_url."id=".$params['id']."&"."service=".$params['service']); break;
            $output = @file_get_contents($url.$service_url."id=".$params['id']."&"."service=".$params['service'],0,$ctx);
            //parse JSON output
            $data = json_decode($output);
            $result = $data->DeleteTokenResult;
            
           // sleep(2);
            
            $service_url="/DeletePost?";
            $output = @file_get_contents($url.$service_url."id=".$params['id']."&"."service=".$params['service'],0,$ctx);
            //parse JSON output
            $data = json_decode($output);
            $result = $data->DeletePostResult;
            
            
           
            
            if($result==1){  
                
                ?>
                <script>
                    function Updates(){ 
                            window.opener.location.reload(); setTimeout('window.close()',100);
                         }     
                    
                    Updates();
               </script>
                <?php
            }else{
                echo"errore";
                
            }
         
            
         }   
  }catch (Exception $e){
      echo"error";
  }
?>
